package com.zzh.ssi.frame.base;

import com.zzh.ssi.frame.util.PageInfo;

/**
 * Created by IntelliJ IDEA.
 * Date: 13-1-11
 * Time: 下午2:41
 * To change this template use File | Settings | File Templates.
 */
public class BaseDt {
    private String page_start;
    private String page_end;

    public void setSplitPageSql(int currentPage, int pageSize) {
        if (currentPage == 1) {
//            return "SELECT A.*, rownum r FROM (" + sql + ") A WHERE rownum <= " + pageSize;
            this.setPage_start("SELECT A.*, rownum r FROM (");
            this.setPage_end(") A WHERE rownum <= " + pageSize);
        } else {
//            return "SELECT * FROM (SELECT A.*, rownum r FROM (" + sql + ") A WHERE rownum <= " + currentPage * pageSize + ") B WHERE r > " + (currentPage - 1) * pageSize;
            this.setPage_start("SELECT * FROM (SELECT A.*, rownum r FROM (");
            this.setPage_end(") A WHERE rownum <= " + currentPage * pageSize + ") B WHERE r > " + (currentPage - 1) * pageSize);
        }
    }

    public void setSplitPageSql(PageInfo pb) {
        setSplitPageSql(pb.getCurrentPage(), pb.getPageSize());
    }




    public String getPage_start() {
        return page_start;
    }

    public void setPage_start(String page_start) {
        this.page_start = page_start;
    }

    public String getPage_end() {
        return page_end;
    }

    public void setPage_end(String page_end) {
        this.page_end = page_end;
    }
}
